/* login.js */
const app = getApp()
Page({
	data : {
		currentUser : null
	},
	onShow () {
		let service = app.globalData.imService;
		this.setData({
			currentUser : service.currentUser
		});

		if(!this.data.currentUser) {
			wx.redirectTo({
				url : '../login/login'
			})
		}
	},
	logout () {
		wx.im.disconnect().then(() => {
			console.log("断连成功");
			wx.removeStorageSync("currentUser");
			app.globalData.imService= null;
			wx.redirectTo({
				url: '../login/login'
			})
		})
	}
})